import { createRouter, createWebHashHistory } from "vue-router";
import {routerBefore} from './routerBefore.js'
const routes=[
  {
    path: '/redirect',
    component: () => import('@/components/Layout/index.vue'),
    hidden: true,
    children: [
      {
        path: '/redirect/:path(.*)',
        name:'redirect',
        component: () => import('@/components/Redirect.vue')
      }
    ]
  },
  {
    path:'/',
    redirect:'/user',
    component: () => import('@/components/Layout/index.vue'),
    meta:{
      hidden:false,
      title:'系统管理',
      icon:'Tools'
    },
    children:[
      {
        path:'/home',
        component:()=>import('@/views/home.vue'),
        meta:{
          hidden:false,
          title:'首页',
          icon:'HomeFilled'
        }
      },
      {
        path:'/user',
        name:'user',
        component:()=>import('@/views/system/user/index.vue'),
        meta:{
          keep:true,
          hidden:false,
          title:'用户管理',
          icon:'UserFilled'
        }
      },
      {
        path:'/role',
        name:'role',
        component:()=>import('@/views/system/role/index.vue'),
        meta:{
          keep:true,
          hidden:false,
          title:'角色管理',
          icon:'Avatar'
        }
      },
      {
        path:'/menu',
        component:()=>import('@/views/system/menu/index.vue'),
        meta:{
          hidden:false,
          title:'菜单管理',
          icon:'List'
        }
      },
      {
        path:'/dict',
        component:()=>import('@/views/system/dict/index.vue'),
        meta:{
          hidden:false,
          title:'字典管理',
          icon:'Management'
        }
      },
    ]
  },
]
const router = createRouter({
  history: createWebHashHistory(),
  routes,
});
routerBefore(router)
export default router